<template>
	<om-formsub-outer :index="index" :checkedit="checkedit">
		<om-autoform ref="autoform" :initConfigData="autoformdata" :initValue="initValue"></om-autoform>
	</om-formsub-outer>
</template>

<script>
	import {buildSubFormData, subOnLoad, changeEditor,configSelectData,hasValue} from '@/static/js/formUtil.js';
	import { ignoreHtml,ptFloat,minusF,getDateStr} from '@/static/js/common.js';
	export default {
		provide() {
			return {
				formPage: this
			};
		},
		data() {
			return buildSubFormData()
		},
		methods:{
			initLoad(){
				let _that = this
				let arr = [
					_that.om.request(
						"customer/getCustomer",
						{
							code:'39013'
						}
					),
					_that.om.request(
						"customer/getCustomer",
						{
							code:'39113'
						}
					),
					_that.om.request(
						"dictZero/getListByCode",
						{
							code:'23591'
						}
					)
				]
				Promise.all(arr).then(res=>{
					_that.$refs.autoform.changeEditor("title2","postTypeId","data",configSelectData(res[0],"id","dicname"))
					_that.$refs.autoform.initSelectIndex("title2","postTypeId")
					_that.$refs.autoform.changeEditor("title2","roleId","data",configSelectData(res[1],"id","dicname"))
					_that.$refs.autoform.initSelectIndex("title2","roleId")
					_that.$refs.autoform.changeEditor("title2","sexCode","data",configSelectData(res[2],"id","dicname"))
					_that.$refs.autoform.initSelectIndex("title2","sexCode")
					
				})
			}
		},
		onShow() {
			
		},
		onLoad(e) {
			let _that = this
			subOnLoad(_that, e, function() {
			if(e.configDataCacheKey){
				uni.getStorage({
					key: e.configDataCacheKey,
					success: function(res) {
						if(res.data && Object.prototype.toString.call(res.data)==='[object Array]'){
							_that.autoformdata = res.data
							Object.assign(_that.initValue, _that.formdata)
							_that.autoformdata[0].order = _that.order
								_that.initLoad()

							}
						}
					})
				}
							
			})
		}
	}
</script>

<style>
</style>                                                                                                                                                                                                                                                                                                                                                                                                                                                         
